<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <button>删除</button>
    <ul>
        <li>熊大</li>
        <li>熊二</li>
        <li>光头强</li>
    </ul>
    <script>
        var ul = document.querySelector('ul');
        var btn = document.querySelector('button');
        //删除元素 node.removechild(child)
        // ul.removeChild(ul.children[0]);
        //3.点击按钮依次删除里面的孩子
        btn.onclick = function () {
            // for (var i = 0;i<ul.children.length;i++){
            //     ul.removeChild(ul.children[i]);
            // }
            if (ul.children.length == 0){
                this.disabled = true;
            }else {
                ul.removeChild(ul.children[0]);
            }
        }
    </script>
</body>
</html>